﻿using Newtonsoft.Json;
using System.Collections.Generic;

namespace LotusIslandOrderProcessing.PLCMake
{
    public class PlcModel
    {
        public string jsonrpc { get; set; } = "2.0";
        public string method { get; set; }
        [JsonProperty("params")]
        public PlcList paramss { get; set; }
        public int id { get; set; } = 1;
    }
    public class PlcModelWrite
    {
        public string jsonrpc { get; set; } = "2.0";
        public string method { get; set; }
        [JsonProperty("params")]
        public PlcListWrite paramss { get; set; }
        public int id { get; set; } = 1;
    }
    public class PlcModelsWrite
    {
        public string jsonrpc { get; set; } = "2.0";
        public string method { get; set; }
        [JsonProperty("params")]
        public PlcOrderWrite paramss { get; set; }
        public int id { get; set; } = 1;
    }
    public class PlcReadModel
    {
        public string jsonrpc { get; set; } = "2.0";
        public string result { get; set; }
        public int id { get; set; } = 1;
    }
    public class PlcList
    {
        public string var { get; set; } = "\"Com_Data\"";


    }
    public class PlcListWrite
    {
        public string var { get; set; } = "\"Com_Data\"";

        public int value { get; set; } = 1;
    }
    public class PlcOrderWrite
    {
        public string var { get; set; } = "\"Com_Data\"";

        public string value { get; set; } = "";
    }
    public class statelist
    {
        private static statelist instance;
        private statelist() { }

        public static statelist Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new statelist();
                }
                return instance;
            }
        }
        public List<string> state = new List<string>()
        {
          "\"Com_Data\".State.Print3",
           "\"Com_Data\".State.Print4",
              "\"Com_Data\".State.Making3",
               "\"Com_Data\".State.Making4",
                    "\"Com_Data\".State.Order_Number3",
                     "\"Com_Data\".State.Order_Number4",
                         "\"Com_Data\".State.Matter[1]",
              "\"Com_Data\".State.Matter[5]",
               "\"Com_Data\".State.Matter[8]",
                  "\"Com_Data\".State.Matter[9]",
                   "\"Com_Data\".State.Matter[10]",
                    "\"Com_Data\".State.Matter[11]",
                     "\"Com_Data\".State.Matter[12]",
                      "\"Com_Data\".State.Matter[13]",
                       "\"Com_Data\".State.Matter[14]",
            "\"Com_Data\".State.Fault[0]",
            "\"Com_Data\".State.Fault[1]"
    };
        public List<string> command = new List<string>()
        {
        "\"Com_Data\".State.Action1",
         "\"Com_Data\".State.Action2",
          "\"Com_Data\".State.Order1",
           "\"Com_Data\".State.Order2",
            "\"Com_Data\".State.Order3"
    };
    }
    public class list
    {
        public List<PlcModel> plcModels { get; set; } = new List<PlcModel>();
    }
    public class PlcRead
    {
        //"jsonrpc":"2.0","id":1,"result":0
        public string jsonrpc { get; set; } = "2.0";
        public int id { get; set; } = 0;
        public string result { get; set; } = "";
    }
}
